/**
 * @Title: StormyInning.java
 * @Package com.thinkinjava.exception
 * @Description: TODO
 * @author Nick
 * @date Jun 25, 2012 10:07:56 PM
 * @version V1.0
 */
package com.thinkinjava.exception;

class BaseballException extends Exception {}

class Foul extends BaseballException {}

class Strike extends BaseballException {}

abstract class Inning {
	
	public Inning() throws BaseballException {}
	
	public void event() throws BaseballException {}
	
	public abstract void atBat() throws Strike, Foul;
	
	public void walk(){}
	
}

class StormException extends Exception {}

class RainedOut extends StormException {}

class PopFoul extends Foul {}

interface Storm {
	public void event() throws RainedOut;
	public void rainHard() throws RainedOut;
}

public class StormyInning extends Inning implements Storm {
	
	//对构造函数添加新的异常 必须处理类构造函数的异常
	public StormyInning() throws RainedOut, BaseballException {

	}
	
	public StormyInning(String s) throws Foul, BaseballException {

	}
	
	//常规方法必须遵照基类
//	void walk () throws PopFoul {}
	
	//接口不能给基类存在的方法添加异常
//	public void event () throws RainedOut {}
	
	//如果方法在基类中不存在，异常是可以的
	public void rainHard() throws RainedOut {
		
	}
	
	//你可以不抛出任何异常，即使基类中有异常抛出
	public void event(){} 
	
	//重载的方法能抛出继承的异常
	public void atBat() throws Strike, Foul {
		
	}
	
	public static void main(String[] args) {
		
	}
	
}
